package com.meteor.user.controller;

import com.meteor.framework.common.base.ResponseData;
import com.meteor.framework.operatelog.annotations.OperateLog;
import com.meteor.framework.operatelog.enums.OperateTypeEnum;
import com.meteor.user.query.SysRoleQuery;
import com.meteor.user.service.WorkingService;
import com.meteor.user.vo.SysRoleVO;
import com.meteor.user.vo.UserWorkingVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 排班管理
 *
 * @author lynn
 * @date 2024/1/22
 */

@RestController
@RequestMapping("sys/working")
@AllArgsConstructor
@Tag(name = "排班管理")
public class WorkingController {


    private final WorkingService workingService;

    @GetMapping("list")
    @Operation(summary = "列表")
    @PreAuthorize("hasAuthority('sys:working:list')")
    public ResponseData list() {

//        List<SysRoleVO> list = sysRoleService.getList(new SysRoleQuery());

        return ResponseData.success(null);
    }


    @PostMapping
    @Operation(summary = "保存")
    @OperateLog(type = OperateTypeEnum.INSERT)
    @PreAuthorize("hasAuthority('sys:working:save')")
    public ResponseData save(@RequestBody @Valid UserWorkingVO vo) {

        workingService.created(vo);
        return ResponseData.success("新增成功");
    }

}
